(function(window, document) {
    function setRemUnit() {
        let docEl = document.documentElement;
        let rem = docEl.clientWidth / 10
        docEl.style.fontSize = rem + 'px'
    };
    setRemUnit();
    window.addEventListener('resize', setRemUnit)
    window.addEventListener('pageshow', function(e) {
        if (e.persisted) {
            setRemUnit()
        }
    });
}(window, document))